import { listLogisticsType } from "@/api/order/order";

const logistics = {
  state: {
    list:[]
  },

  mutations: {
   
    SETLogisticsLIST: (state, data) => {
      state.list = data
    }
  },

  actions: {
      // 获取场馆列表
    GetListLogisticsType({ commit, state }) {
      if (!state.list.length) {
        return new Promise((resolve, reject) => {
            listLogisticsType().then(res => {
            const list = res.data
            list.forEach(item => {
              item.label = item.name;
              item.value = item.type;
            });
              commit('SETLogisticsLIST',list)
            resolve(res)
          }).catch(error => {
            reject(error)
          })
        })
      }
     
    },
  }
}

export default logistics
